package com.example.cinema.bindingdata;

import android.util.Log;
import android.view.View;
import android.widget.ImageView;

import androidx.databinding.BindingAdapter;
import androidx.databinding.ObservableField;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.example.cinema.R;
import com.example.cinema.drawview.RollText;

public class UserInfoData {

    @BindingAdapter("uimage")
    public static void  Image(View view, String url)
    {

        if(url!=null&&view!=null)
        {
            RequestOptions options = new RequestOptions()
                    .placeholder(R.mipmap.defaut_img)
                    .error(R.mipmap.defaut_img)
                    .fallback(R.mipmap.defaut_img);
            Glide.with(view).load(url)
                    .apply(options)
                    .into((ImageView) view);
        }
    }

    @BindingAdapter("rolltexts")
    public static void Roolltextss(View view,String text)
    {
        RollText rollText = (RollText) view;
        rollText.setTexts("尊敬的VIP用户您的VIP时间到期时间为："+text);
        if(text!=null)
        {
            rollText.start();
        }
    }


    public ObservableField<String> usersid = new ObservableField<>();//用户ID
    public ObservableField<String>  userimg = new ObservableField<>();//用户头像
    public ObservableField<String>  username = new ObservableField<>();//用户名
    public ObservableField<String>  useralias = new ObservableField<>();//用户昵称
    public ObservableField<String>  userfans = new ObservableField<>();//用户粉丝数量
    public ObservableField<String>  userlove = new ObservableField<>();//用户获赞数量
    public ObservableField<String>  userfollow = new ObservableField<>();//用户关注数量
    public ObservableField<String>  usertime = new ObservableField<>();//用户时间
    public ObservableField<String>  userfree = new ObservableField<>();//免费次数
    public ObservableField<String>  userscale = new ObservableField<>();//用户等级（根据等级分配佣金）
    public ObservableField<String>  usersuper = new ObservableField<>();//用户上级
    public ObservableField<String>  usercode = new ObservableField<>();//用户特征码
    public ObservableField<String>  useripad = new ObservableField<>();//用户IP地址
    public ObservableField<String>  userstate = new ObservableField<>();//用户状态
    public ObservableField<String>  usertoken = new ObservableField<>();//用户令牌
    public ObservableField<Boolean> uservipstate = new ObservableField<Boolean>();//vip状态
    public ObservableField<Integer> userworks = new ObservableField<>();//作品数量
}
